package com.hualan.sfzy.service.mind.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hualan.sfzy.constant.CommonConstant;
import com.hualan.sfzy.entity.mind.TestResult;
import com.hualan.sfzy.mapper.mind.TestResultMapper;
import com.hualan.sfzy.service.BaseServiceImp;
import com.hualan.sfzy.service.mind.TestResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class TestResultServiceImpl extends BaseServiceImp<TestResult> implements TestResultService {
    @Autowired
    private TestResultMapper testResultMapper;

    @Override
    public Map<String, Object> findByPage(Integer pageNum, Integer pageSize, TestResult testResult) {
        PageHelper.startPage(pageNum, pageSize);
        List<TestResult> list = testResultMapper.select(testResult);
        PageInfo<TestResult> pageInfo = new PageInfo<>(list);

        Map<String, Object> map = new HashMap<>();
        map.put(CommonConstant.PAGE_LIST, list);
        map.put(CommonConstant.PAGE_TOTAL, pageInfo.getPages());
        map.put(CommonConstant.TOTAL, pageInfo.getTotal());
        return map;
    }
}